<?php
include("header.php");
?>
<br/>
<script type="text/javascript">
function form_sub() 
{ 
	var ok = true;
	if(!test_email(document.getElementById("email").value)) 
	{ 
		document.getElementById("lemail").style.color="Red";
		ok = false; 
	}else{
		document.getElementById("lemail").style.color="Black";
	}
	if(!test_null(document.getElementById("nom").value)) 
	{ 
		document.getElementById("lnom").style.color="Red";
		ok = false;  
	}else{
		document.getElementById("lnom").style.color="Black";
	}
	if(!test_null(document.getElementById("prenom").value)) 
	{ 
		document.getElementById("lprenom").style.color="Red";
		ok = false;  
	}else{
		document.getElementById("lprenom").style.color="Black";
	}
	if(!IsNum(document.getElementById("zip").value)) 
	{ 
		document.getElementById("lzip").style.color="Red";
		ok = false;  
	}else{
		document.getElementById("lzip").style.color="Black";
	}
	if(!test_null(document.getElementById("tel").value)) 
	{ 
		document.getElementById("ltel").style.color="Red";
		ok = false;  
	}else{
		document.getElementById("ltel").style.color="Black";
	}

	if(!test_password(document.getElementById("passwd").value,document.getElementById("repasswd").value)) 
	{ 
		document.getElementById("lpasswd").style.color="Red";
		document.getElementById("lrepasswd").style.color="Red";
		ok = false;  
	}else{
		document.getElementById("lpasswd").style.color="Black";
		document.getElementById("lrepasswd").style.color="Black";
	}

	if(ok){
		document.getElementById("regform").submit();
	}
} 
</script>
<form id="regform" action="reged.php" method="post">

<label id="lemail">Email</label>
<input id="email" name="email" type="text"></input><br/>
<label id="lpasswd">Mot de passe</label>
<input id="passwd" name="passwd" type="password"></input><br/>
<label id="lrepasswd">Mot de passe</label>
<input id="repasswd" name="repasswd" type="password"></input><br/>
Civilité 
<select name="sex">
	<option value="M.">M.</option>
	<option value="Mme">Mme</option>
</select>
<br/>
<label id="lnom">Nom</label>
<input id="nom" name="nom" type="text"></input><br/>
<label id="lprenom">Prénom</label>
<input id="prenom" name="prenom" type="text"></input><br/>
<label id="lzip">Code postal</label>
<input id="zip" name="zip" type="text"></input><br/>
<label id="ltel">Téléphone mobile</label>
<input id="tel" name="tel" type="text"></input><br/>
<input type="button" value="créer le compte" onClick="form_sub()"></input>
</form>